import 'package:floor/floor.dart';

import '../entity/book.dart';

@dao
abstract class BookDao {
  @Query('SELECT COUNT(*) FROM Book')
  Future<int?> getBookCount();

  @Query('SELECT * FROM Book')
  Future<List<Book>> findAllBooks();

  @Query('SELECT * FROM Book WHERE isbn = :isbn LIMIT 1')
  Future<Book?> findBookByIsbn(String isbn);

  @insert
  Future<void> insertBook(Book book);

  @update
  Future<void> updateBook(Book book);

  @delete
  Future<void> deleteBook(Book book);
}